<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>AutoTrim</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>AutoTrim</h1>

<p>Determines whether <code><a href="SetEnv.htm">Var1 = %Var2%</a></code> statements omit spaces and tabs from the beginning and end of <em>Var2</em>.</p>

<pre class="Syntax">AutoTrim, On|Off</pre>
<h3>Parameters</h3>
<dl>

  <dt>On|Off</dt>
  <dd><p><strong>On</strong>: In a statement such as <code><a href="SetEnv.htm">Var1 = %Var2%</a></code>, tabs and spaces at the beginning and end of a <em>Var2</em> are omitted from <em>Var1</em>. This is the default.</p>
      <p><strong><a name="Off"></a>Off</strong>: Such tabs and spaces are not omitted.</p>
      <p>Any literal tabs and spaces are omitted regardless of this setting. Prior to v1.1.06, this included `t and any escaped literal spaces or tabs. For example, when AutoTrim is Off, the statement <code>Var = `t</code> assigns a tab character on v1.1.06 and an empty string on earlier versions.</p></dd>

</dl>

<h3>Remarks</h3>
<p>If this command is not used by a script, the setting defaults to ON.</p>
<p>The built-in variable <strong>A_AutoTrim</strong> contains the current setting (On or Off).</p>
<p>The built-in variables <a href="../Variables.htm#Space">A_Space</a> and <a href="../Variables.htm#Tab">A_Tab</a> contain a single space and single tab character, respectively.</p>
<p>AutoTrim does not affect <a href="SetExpression.htm">expression assignments</a> such as <code>Var := &quot; string &quot;</code>. In other words, leading and trailing spaces and tabs are always retained in such cases.</p>
<p>Every newly launched <a href="../misc/Threads.htm">thread</a> (such as a <a href="../Hotkeys.htm">hotkey</a>, <a href="Menu.htm">custom menu item</a>, or <a href="SetTimer.htm">timed</a> subroutine) starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part of the script).</p>
<h3>Related</h3>
<p><a href="SetEnv.htm">SetEnv</a></p>
<h3>Examples</h3>
<pre class="NoIndent">AutoTrim, off
NewVar1 = %OldVar%  <em>; If OldVar contains leading and trailing spaces, NewVar will have them too.</em>
NewVar2 = %A_Space%  <em>; With AutoTrim off, a single space can be assigned this way.</em>

Var1 := &quot;`t&quot; <strong>.</strong> Var2 <strong>.</strong> &quot; &quot;  <em>; The setting of AutoTrim doesn't matter because this is an <a href="../Variables.htm#Expressions">expression</a>.</em></pre>

</body>
</html>
